//************************************************************************
/// <copyrigth>2024-2025 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// You can inherit it to get the o-t power
/// Note:Your own interface must inherit the ITarget
///</describe>
/// <date>2024/5/6</date>
///***********************************************************************
#ifndef TARGETBASE_H
#define TARGETBASE_H

#include "ModuleLoader/ModuleConfig.h"
#include "ITarget.h"
#include "Target.h"

namespace SystemTool
{
    template <class T = ITarget>
    class CLASS_ITEM TargetBase : public T
    {
    public:
        // Constrcut the obj
        TargetBase(){    }

        // Destruct the obj
        virtual ~TargetBase(){    }
    
    private:
        // Copy construct
        TargetBase(const TargetBase &other) = delete;

        // Assignment
        TargetBase& TargetBase(const TargetBase &other) = delete;

    public:
        // Add observer(Target do it)
        virtual void Add(IObserver *pObserver)
        {
            m_Target.Add(pObserver);
        }

        // Remove the observer(Target do it)
        virtual void Remove(IObserver *pObserver)
        {
            m_Target.Remove(pObserver);
        }

        // Post Target(Target do it)
        virtual void Post(NotifyArgs &Args)
        {
            m_Target.Post(Args);
        }

    private:
        // Target
        Target m_Target;
    };
}

#endif // TARGETBASE_H
